package com.xm.thread.wait2notify;

import lombok.extern.slf4j.Slf4j;

import java.util.concurrent.CountDownLatch;

/**
 * 方案3：使用CountDownLatch（一次性等待）
 */
@Slf4j
public class WaitToNotify04 {

    CountDownLatch latch = new CountDownLatch(3);

    Runnable worker = () -> {
        log.info("工作线程[{}]", Thread.currentThread().getName());
        latch.countDown();
    };

}

